package com.javawork.igossip;

import com.javawork.igossip.model.User;

import android.os.Bundle;
import android.app.Activity;
import android.content.Intent;
import android.graphics.drawable.BitmapDrawable;
import android.graphics.drawable.Drawable;
import android.view.Menu;
import android.view.View;
import android.widget.TextView;
import android.widget.Toast;

public class ContactDetailActivity extends Activity {

	TextView text_name, text_desc, text_tags, btn_action;
	int action_type = 0;

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.activity_contact_detail);
		text_name = (TextView) findViewById(R.id.text_user_name);
		text_desc = (TextView) findViewById(R.id.text_user_description);
		text_tags = (TextView) findViewById(R.id.text_user_tags);
		btn_action = (TextView) findViewById(R.id.text_button_user_action);
		// User user = (User)getIntent().getSerializableExtra("user");
		User user = User.publicUser;
		text_name.setText(user.name_profile);
		BitmapDrawable user_avatar = new BitmapDrawable(getResources(),
				user.photo);
		user_avatar.setBounds(0, 0, 50, 50);
		text_name.setCompoundDrawables(user_avatar, null, null, null);
		text_desc.setText(user.description);
		text_tags.setText(user.tags.toArray().toString());
		if (user.gender == UserManager.User.gender) {
			action_type = 0;
			btn_action
					.setText(getResources().getString(R.string.button_new_pm));
		} else {
			action_type = 1;
			btn_action.setText(getResources().getString(
					R.string.button_new_gossip));
		}
	}

	@Override
	public boolean onCreateOptionsMenu(Menu menu) {
		// Inflate the menu; this adds items to the action bar if it is present.
		getMenuInflater().inflate(R.menu.contact_detail, menu);
		return true;
	}

	public void back_button_click(View v) {
		this.finish();
	}

	public void action_button_click(View v) {
		// Toast.makeText(this, "Ha", Toast.LENGTH_SHORT).show();
		Intent intent = new Intent(ContactDetailActivity.this,
				GossipEditActivity.class);
		startActivity(intent);
	}

}
